package vn.orderonline.com.core.business.admin;

import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import vn.orderonline.core.dao.RoleDao;
import vn.orderonline.core.dao.entity.Role;

@Service
@Transactional
public class RoleImpl implements IRole {
	
	@Autowired
	public RoleDao roleDao;

	@Override
	public Map<String, String> getAllRoles() {

		Map<String, String> map = new LinkedHashMap<String, String>();
		List<Role> list = roleDao.findAll();
		for(Iterator<Role> ite = list.iterator(); ite.hasNext();) {
			Role role = ite.next();
			map.put(role.getRoleId().toString(), role.getRoleName());
		}
		return map;
	}
}
